package com.project.naberboard.dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.project.naberboard.ibatis.SqlDaoSuport;
import com.project.naberboard.vo.BoardVo;

public class BoardManager extends SqlDaoSuport implements IBoardManager {
	
	public List<BoardVo> getAllBoard() {
		List<BoardVo> list = new ArrayList<BoardVo>();
		try {
			list = (List<BoardVo>) this.getSqlMapClient().queryForList("board.getAllBoard");
		} catch (SQLException e) {
			e.printStackTrace();
		}

		return list;
	}

	public BoardVo getABoard(String seq) {
		BoardVo vo = new BoardVo();
		try {
			vo = (BoardVo) this.getSqlMapClient().queryForObject("board.getABoard", seq);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	
		return vo;
	}

	@Override
	public int deleteBoard(String seq) {
		int result = 1;
		try {
			this.getSqlMapClient().delete("board.deleteBoard",seq);
		} catch (SQLException e) {
			result = -1;
		}
		return result;
	}

	public int writeBoard(BoardVo vo) {
		return 0;
	}

	public int modifyBoard(BoardVo vo) {
		return 0;
	}
}
